<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name',30);
            $table->string('username',30)->unique()->comment('登录账号');
            $table->string('email',50)->nullable('用户邮箱');
            $table->string('mobile',50)->nullable('手机号');
            $table->string('password',200)->nullable()->comment('用户密码');
            $table->tinyInteger('is_super')->default(0)->comment('是否是超级用户：0=否，1=是');
            $table->tinyInteger('user_active')->default(0)->comment('用户是否有效：1=未生效，2=已生效，3=已禁用');
            $table->string('mobile_verify_code', 10)->nullable()->comment('用户手机验证码');
            $table->dateTime('mobile_verify_begin')->nullable()->comment('用户手机验证的开始时间，超过60秒过期');
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
